package com.jz.digital.adapter

import android.graphics.Color
import android.graphics.Typeface
import android.util.TypedValue
import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.jz.digital.R

/**
 * @author WangYong
 * @date 2024/12/21 08:18
 * @description:
 */
class LanguageSelectAdapter(data: MutableList<String>, var selectPosition: Int) :
    BaseQuickAdapter<String, BaseViewHolder>(
        R.layout.item_language_select_layout, data
    ) {
    override fun convert(holder: BaseViewHolder, item: String) {
        val tvTitle = holder.getView<TextView>(R.id.tv_title)
        tvTitle.text = item
        if (holder.layoutPosition == selectPosition) {
            tvTitle.setTextColor(Color.BLACK)
            tvTitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, 15f)
            tvTitle.setTypeface(null, Typeface.BOLD)
        } else {
            tvTitle.setTextColor(Color.parseColor("#535254"))
            tvTitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13f)
            tvTitle.setTypeface(null, Typeface.NORMAL)
        }
    }
}